package cn.virens.common.boot.provider.apijson;


import cn.virens.common.util.exception.APIException;

import java.io.Serializable;
import java.util.function.Supplier;

@SuppressWarnings("serial")
public class VirValue<T> implements Serializable {
    private T object;

    public T set(T object) throws APIException {
        return this.object = object;
    }

    public T get(Supplier<T> supplier) throws APIException {
        if (object == null && supplier != null) {
            object = supplier.get();
        }

        return object;
    }
}
